Skip to content

Conversation

@MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Dec 31, 2019

What changes were proposed in this pull request?

In the PR, I propose to throw AnalysisException when a removed SQL config is set to non-default value. The following SQL configs removed by #26559 are marked as removed:

  1. spark.sql.fromJsonForceNullableSchema
  2. spark.sql.legacy.compareDateTimestampInTimestamp
  3. spark.sql.legacy.allowCreatingManagedTableUsingNonemptyLocation

Why are the changes needed?

To improve user experience with Spark SQL by notifying of removed SQL configs used by users.

Does this PR introduce any user-facing change?

Yes, before the set command was silently ignored:

spark-sql> set spark.sql.fromJsonForceNullableSchema=false;
spark.sql.fromJsonForceNullableSchema	false

after the exception should be raised:

spark-sql> set spark.sql.fromJsonForceNullableSchema=false;
Error in query: The SQL config 'spark.sql.fromJsonForceNullableSchema' was removed in the version 3.0.0. It was removed to prevent errors like SPARK-23173 for non-default value.;

How was this patch tested?

Added new tests into SQLConfSuite for both cases when removed SQL configs are set to default and non-default values.

@SparkQA
Copy link

SparkQA commented Dec 31, 2019

Test build #115984 has finished for PR 27057 at commit 73f887c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

* map values are tuples of default config value and the version in which
* the SQL config was removed.
*/
val removedSQLConfigs = Map[String, (String, String)](
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yeah. I was thinking about having this mechanism in SQL configurations too but couldn't find some time to fix.
There is an example to follow in SparkConf, for example, see deprecatedConfigs.

Can you match how it looks like? Then it should be good to go.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to add more info, deprecatedConfigs works like removedSLQConfigs (because they are deprecated first and removed out).

@HyukjinKwon
Copy link
Member

cc @vanzin @cloud-fan @gatorsmile who I talked about this with


test("set removed configs to non-default values") {
Seq(
"spark.sql.fromJsonForceNullableSchema" -> false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we only test one config? Otherwise we may need to update this test again and again when we remove more configs in the future.

In cannot set/unset static SQL conf we only test one config too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I will test only spark.sql.fromJsonForceNullableSchema

@cloud-fan
Copy link
Contributor

LGTM, nice feature!

@SparkQA
Copy link

SparkQA commented Jan 2, 2020

Test build #116030 has finished for PR 27057 at commit 9b7bd7a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 2, 2020

Test build #116044 has finished for PR 27057 at commit e9e63ae.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

"It was removed to prevent loosing of users data for non-default value."),
RemovedConfig("spark.sql.legacy.compareDateTimestampInTimestamp", "3.0.0", "true",
"It was removed to prevent errors like SPARK-23549 for non-default value.")
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks a nice feature. Just a question; any policy about when these entries will be removed in this list? We need to keep them forever, or we can remove them sometime?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove those after few minor releases or when we bump up the major release.

@HyukjinKwon
Copy link
Member

Merged to master.

@MaxGekk are you also interested in grouping deprecated configurations too? Hope we can remove out legacy configurations out a bit more aggressively by leveraging those mechanism.

@MaxGekk
Copy link
Member Author

MaxGekk commented Jan 3, 2020

are you also interested in grouping deprecated configurations too?

yes, I am.

@MaxGekk
Copy link
Member Author

MaxGekk commented Jan 3, 2020

Here is the PR #27092

@MaxGekk MaxGekk deleted the remove-sql-configs-followup branch June 5, 2020 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants